package hospital;

/**
 * @author oldliu
 * @since 1.0
 */
public class UglyNum {
    public static void main(String[] args) {
        int start = 1;
        int count = 1;
        int n;
        System.out.print("\t" + start);
        while (count <= 1500) {
            start++;
            n = start;
            while (n > 1 && n % 2 == 0) {
                n /= 2;
            }
            while (n > 1 && n % 3 == 0) {
                n /= 3;
            }
            while (n > 1 && n % 5 == 0) {
                n /= 5;
            }
            if (n == 1) {
                System.out.print("\t" + start);
                count++;
                if (count % 10 == 0) {
                    System.out.print("\n");
                }
            }
        }
    }
}
